👀 Reading hidden code
👀 Reading hidden code
missing
👀 Reading hidden code
👀 Reading hidden code
using HypertextLiteral
: @htl, @htl_str
ClickCounter (generic function with 2 methods)
👀 Reading hidden code
ClickCounter(text="Click") = @htl("""
<span>
<script>
// Select elements relative to `currentScript`
const span = currentScript.parentElement
const button = span.querySelector("button")
// we wrapped the button in a `span` to hide its default behaviour from Pluto
let count = 0
const update_button_label = () => {
button.innerText = label + " " + count
}
button.addEventListener("click", (e) => {
count += 1
update_button_label()
// we dispatch the input event on the span, not the button, because
// Pluto's `@bind` mechanism listens for events on the **first element** in the